package cn.tedu.reflection;

import org.junit.Test;

import java.lang.reflect.Constructor;

/*
Author     :Dsi
Date       : 2021/11/23 17:37
Description:
*/
public class Demo01 {
    @Test
    public void getCon() throws Exception {
        //new Cat().getClass();//不能new，因为含参构造被private修饰了
        Class<?> catClass = Cat.class;
        //Class<?> aClass = Class.forName("cn.tedu.reflection.Person");

        System.out.println(catClass);//字节码对象
        System.out.println(catClass.getName());//字节码名字
        System.out.println(catClass.getPackage());//
        System.out.println(catClass.getPackage().getName());

        Constructor<?> declaredConstructor = catClass.getDeclaredConstructor();
        declaredConstructor.setAccessible(true);

        Object o = declaredConstructor.newInstance();
        Constructor<?>[] declaredConstructors = catClass.getDeclaredConstructors();



    }
}
